package com.fessc.develop.job;

import com.fessc.develop.entity.dbvo.SettleTrade;
import com.fessc.develop.handler.CCBSettleTradePushHandler;
import com.fessc.develop.model.enums.EnumTaskCode;
import com.fessc.develop.service.interfaces.ISettleTradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 建行订单清算推送
 */
@Slf4j
@Service
public class CCBSettleTradePushJob extends ScheduleJob{

    @Resource
    private ISettleTradeService settleTradeService;

    @Resource
    private CCBSettleTradePushHandler ccbSettleTradePushHandler;

    @Override
    public String execute() {
        //获取推送银行的结果集
        log.info("查询建行跨境付汇待发送结果集");
        List<SettleTrade> settleTrades = settleTradeService.getCCBSettleTradeByBankIdToPush(getCCBBankId(), getTaskTermDate(),"Y");
        ccbSettleTradePushHandler.settleTradePush(settleTrades);
        return null;
    }

    @Override
    public String getTaskCode() {
        return EnumTaskCode.CCB_SETTLE_TRADE_PUSH.toString();
    }
}
